1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
#![allow(non_camel_case_types, non_snake_case)]
use crate::decl::*;
use crate::dxgi::iterators::*;
use crate::kernel::ffi_types::*;
use crate::ole::privs::*;
use crate::prelude::*;
use crate::vt::*;
/// [`IDXGIAdapter`](crate::IDXGIAdapter) virtual table.
#[repr(C)]
pub struct IDXGIAdapterVT {
pub IDXGIObjectVT: IDXGIObjectVT,
pub EnumOutputs: fn(COMPTR, u32, *mut COMPTR) -> HRES,
pub GetDesc: fn(COMPTR, PVOID) -> HRES,
pub CheckInterfaceSupport: fn(COMPTR, PCVOID, *mut i64) -> HRES,
}
com_interface! { IDXGIAdapter: "2411e7e1-12ac-4ccf-bd14-9798e8534dc0";
/// [`IDXGIAdapter`](https://learn.microsoft.com/en-us/windows/win32/api/dxgi/nn-dxgi-idxgiadapter)
/// COM interface over [`IDXGIAdapterVT`](crate::vt::IDXGIAdapterVT).
///
/// Automatically calls
/// [`Release`](https://learn.microsoft.com/en-us/windows/win32/api/unknwn/nf-unknwn-iunknown-release)
/// when the object goes out of scope.
}
impl dxgi_IDXGIObject for IDXGIAdapter {}
impl dxgi_IDXGIAdapter for IDXGIAdapter {}
/// This trait is enabled with the `dxgi` feature, and provides methods for
/// [`IDXGIAdapter`](crate::IDXGIAdapter).
///
/// Prefer importing this trait through the prelude:
///
/// ```no_run
/// use winsafe::prelude::*;
/// ```
pub trait dxgi_IDXGIAdapter: dxgi_IDXGIObject {
/// [`IDXGIAdapter::CheckInterfaceSupport`](https://learn.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiadapter-checkinterfacesupport)
/// method.
#[must_use]
fn CheckInterfaceSupport(&self, interface_name: &GUID) -> HrResult<i64> {
let mut umd_ver = i64::default();
ok_to_hrresult(
unsafe {
(vt::<IDXGIAdapterVT>(self).CheckInterfaceSupport)(
self.ptr(),
interface_name as *const _ as _,
&mut umd_ver,
)
},
).map(|_| umd_ver)
}
/// [`IDXGIAdapter::EnumOutputs`](https://learn.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiadapter-enumoutputs)
/// method.
///
/// Returns an iterator over [`IDXGIOutput`](crate::IDXGIOutput) elements.
///
/// # Examples
///
/// ```no_run
/// use winsafe::{self as w, prelude::*};
///
/// let adapter: w::IDXGIAdapter; // initialized somewhere
/// # let adapter = unsafe { w::IDXGIAdapter::null() };
///
/// for output in adapter.EnumOutputs() {
/// let output = output?;
/// // ...
/// }
///
/// // Collecting into a Vec
/// let outputs: Vec<w::IDXGIOutput> =
/// adapter.EnumOutputs()
/// .collect::<w::HrResult<Vec<_>>>()?;
/// # w::HrResult::Ok(())
/// ```
#[must_use]
fn EnumOutputs(&self) -> impl Iterator<Item = HrResult<IDXGIOutput>> + '_ {
IdxgiadapterEnumoutputsIter::new(self)
}
/// [`IDXGIAdapter::GetDesc`](https://learn.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiadapter-getdesc)
/// method.
///
/// # Examples
///
/// ```no_run
/// use winsafe::{self as w, prelude::*};
///
/// let adapter: w::IDXGIAdapter; // initialized somewhere
/// # let adapter = unsafe { w::IDXGIAdapter::null() };
/// let mut desc = w::DXGI_ADAPTER_DESC::default();
///
/// adapter.GetDesc(&mut desc)?;
/// # w::HrResult::Ok(())
/// ```
fn GetDesc(&self, desc: &mut DXGI_ADAPTER_DESC) -> HrResult<()> {
ok_to_hrresult(
unsafe {
(vt::<IDXGIAdapterVT>(self).GetDesc)(
self.ptr(),
desc as *mut _ as _,
)
},
)
}
}